<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\PayUnderline
 *
 * @property int $id
 * @property int $uid
 * @property int $order_id
 * @property string $pay_no
 * @property int|null $status
 * @property int $created_at
 * @property-read \App\Models\Order $order
 * @property-read \App\Models\User $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PayUnderline whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PayUnderline whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PayUnderline whereOrderId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PayUnderline wherePayNo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PayUnderline whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PayUnderline whereUid($value)
 * @mixin \Eloquent
 */
class PayUnderline extends Model
{
    protected $table = 'pay_underline';
    protected $primaryKey = 'id';
    protected $guarded = [];

    public $timestamps = false;

    public static function boot()
    {
        parent::boot(); // TODO: Change the autogenerated stub
        static::creating(function ($model){
            $model->created_at = time();
        });
    }

    public function user()
    {
        return $this->belongsTo(User::class, 'uid', 'uid');
    }

    public function order()
    {
        return $this->belongsTo(Order::class, 'order_id', 'order_id');
    }
}
